package com.juc.executorService.executorService2;

import java.util.ArrayList;
import java.util.List;
import java.util.concurrent.ExecutionException;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;

/**
 * 
 * 此实验验证在快的任务优先执行完毕后，执行慢的任务出现异常时，默认情况下
 * 不会在控制台输出异常信息，如果显示使用try-catch 语句块则可以自定义捕获异常
 * 
 *
 */
public class Run {

	public static void main(String[] args) throws InterruptedException, ExecutionException {
		List list = new ArrayList();
		list.add(new MyCallableA());
		list.add(new MyCallableB());
		ExecutorService executorService = Executors.newCachedThreadPool();
		String getString = (String) executorService.invokeAny(list);
		System.out.println( "zzzzzzzzz  " + getString);
	}
}
